package arbore;

import visitors.Visitor;


public class Nod extends NodAbstract
{
	protected NodAbstract nodS;
	protected NodAbstract nodD;
	
	public Nod(int x)
	{
		this.x=x;
	}
	
	public Nod(int x, NodAbstract s, NodAbstract d) 
	{
		this.x = x;
		this.nodS = s;
		this.nodD =d;
	}
	
	public NodAbstract getNodS() {
		return nodS;
	}

	public void setNodS(Nod nodS) {
		this.nodS = nodS;
	}

	public NodAbstract getNodD() {
		return nodD;
	}

	public void setNodD(Nod nodD) {
		this.nodD = nodD;
	}

	public void acceptVisitor(Visitor v) 
	{
		v.visit(this);
		
	}
	
	
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Nod other = (Nod) obj;
		if (nodD == null) {
			if (other.nodD != null)
				return false;
		} else if (!nodD.equals(other.nodD))
			return false;
		if (nodS == null) {
			if (other.nodS != null)
				return false;
		} else if (!nodS.equals(other.nodS))
			return false;
		if (x != other.x)
			return false;
		return true;
	}
	
		

}

//mai de completat din lab3 de pe site-ul lui